Collection Initialize is used to initialize multiple object values at once. In general, collection initialize are created by using the “List” collection class and the list collection class is initialized from “ I enumerable” Interface.
Name space CA Sample { Class Employee 2 { Public int age, Emp Id; Public String ename, address; } Class Example 6 { Static void Main () { List <Employee 2> Emp list = New list < Employee 2> () { New Employee 2 { emp id = 101 , e name = “R” Add. “hyd”, “Age = 22”} New Employee 2 { emp id = 102 , e name = “V” Add. “bglr”, “Age = 24”} }; For each (var x in emplist) C.W.L (“X.emp id +”,”+x.ename +”,”+x.add+ “,”+x.age); Read (); } } }
A LINQ Query that is divided into 3 types:-
Inclined to build a profession as ASP.net Developer? Then here is the blog post on, explore ASP.net Training
Syn:- From Variable in collection Name Where condition Select variable. Select variable (select clause)
Name space CA Sample { Class Employee 7 { Static void Main () Step 1 // List <int> L1 = new list <int> {1,2,3,4,5,6,7,8,9,10}; Var R = From X in L1 where XYZ == 0 Select X; //step 2 C.W.L (“Even No in The list are :-”); For each (var I in R); //step 3 Write (I + “”); Read (); } } }
For in-depth understanding click on
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.